package org.example.elm_xiangmu.service.impl;


import org.example.elm_xiangmu.mapper.BusinessMapper;
import org.example.elm_xiangmu.po.Business;
import org.example.elm_xiangmu.result.Result;
import org.example.elm_xiangmu.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessServiceImpl implements BusinessService {
    @Autowired
    BusinessMapper businessMapper;
    @Override
    public List<Business> list(Integer orderTypeId) {

        return businessMapper.list(orderTypeId);
    }

    @Override
    public Result getById(Integer businessId) {
            Business business = businessMapper.getById(businessId);
            if (business == null) {
                return Result.error("商家不存在");
            }else {
                return Result.success(business,"查询商家成功");
            }
    }

    @Override
    public Business getBusinessById(Integer businessId) {
        return businessMapper.getById(businessId);
    }

    @Override
    public List<Business> getAllBusiness() {
        return businessMapper.getAllBusiness();
    }
}
